﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Abs_classes_data;
using System_States_Signals;

namespace Conc_classes_data
{
    public class temp_controller : abs_controller
    {
        public temp_controller(tank obj, Double normal_value)
            : base(obj, normal_value)
        {
            
        }

        protected override void Create_Sensor(abs_controlled_object obj)
        {
            temp_sensor sens = new temp_sensor((tank)obj);
            this._sensor = sens;
        }

        public override Value_State Check_statement()
        {
            Value_State s;
            Console.WriteLine("Checking");
            if (abs_sensor.Not_Initialized == this._sensor.Value)
            {
                s = Value_State.Not_Initialized;
            }

            if (this._sensor.Value > 70)
            {
                s = Value_State.Crash;
            }
            else
            {
                if (this._sensor.Value > this._normal_value + 10)
                {
                    s = Value_State.Check;
                }
                else
                {
                    s = Value_State.Normal;
                }
            }
            Console.WriteLine(s.ToString());
            return s;            
        }

        public override void Do_Work(double value)
        {
            throw new NotImplementedException();
        }

        public override void Do_Crash()
        {
            ((tank)Object).Temperature = 80;
        }
    }
}
